<?php
namespace control;
/*
*会议室档案类
*/

class meetingClass extends adIndexClass
{
    private const page = 'meeting';
    private const table = 'meeting_room';
    private const title = '会议室档案';
    public array $stateOption = ['正常','维护中','停用'];

    /**
     * 字段初始化
     */
    public function fieldInit($fun): array
    {
        switch ($fun) {
            default:
                $tr = [
                    'type'      => [
                        'name'  => "分类",
                        'width' => 200,
                        'sort' => 1,
                    ],
                    'name' => [
                        'name'  => "名称",
                        'width' => 300,
                        'sort' => 1,
                    ],
                    'maxPeople'  => [
                        'name'  => "可容纳人数",
                        'width' => 200,
                        'sort' => 1,
                    ],
                    'location'         => [
                        'name'  => '所在位置',
                        'width' => 200,
                        'sort' => 1,
                    ],
                    'device'          => [
                        'name'  => '设备',
                        'width' => 200,
                        'sort' => 1,
                    ],
                    'managerId'    => [
                        'name'  => '负责人',
                        'width' => 200,
                    ],
                    'state'    => [
                        'name'  => '状态',
                        'width' => 200,
                        'sort' => 1,
                    ]
                ];
        }
        return $tr;
    }

    /*列表页-查询条件*/
    public function homeOptions($isAsync = true)
    {
        //生成查询表单
        $html = $this->tableShow([
            [
                [
                    "分类" => select(["name" => "type", 'option'=>explode('，', para('meetingRoomType'))]),
                    "名称"     => text(array("name" => "name")),
                    "所在位置"     => text(array("name" => "location")),

                ],
                [
                    "设备"     => text(array("name" => "device")),
                    '负责人'   => selectMultiple(["name" => "managerId",'class'=>'width200', 'table'=>"staff",'sqlId'=>'stid','sqlField'=>'name']),
                    "状态" => select(["name" => "state", 'option' => $this->stateOption]),
                ]
            ]
        ],1);
        //返回
        if(!$isAsync){
            return $html;
        }else{
            return json_encode(['html'=>$html],320);
        }
    }

    /*列表-查询条件*/
    public function home()
    {
        $html = $this->homeOptions(false);
        //控件
        $button = "";
        $url = root . "control/adIndex.html?cla=" . self::page;
        if ($this->power(self::page, "edit")) {
            $button .= "<span onclick=\"layer('".self::page."','edit')\" class='spanButton'>新增</span>";
        }
        if ($this->power(self::page, "del")) {
            $button .= "<span class='spanButton' onclick=\"layer('".$this->get('cla')."', 'operate', {'act': 'del'})\">删除</span>";
        }
        if ($this->power(self::page, 'import')) {
            $button .="<span class='spanButton' onclick=\"layer('importTemplate','importFrame',{cla:'".self::page."'})\">导入</span>";
        }
        if ($this->power(self::page, "export")) {
            $button .="<span class='spanButton' onclick=\"layer('importTemplate','exportFrame',{cla:'".self::page."'})\">导出</span>";
        }
        //返回
        return $this->homeFun($this->search($html,layout: 'pop',toolButton: $button));
    }

    /*客户列表-查询结果*/
    public function homeSearch()
    {
        //like查询数组
        $like = array(
//            "orderNo" => $this->post('orderNo'),//编号
            "name" => $this->post('name'),//名称
            "location" => $this->post('location'),//所在位置
            "device" => $this->post('device'),//设备
        );
        //全等查询数组
        $equal = array(
            "managerId" => $this->post('managerId'),//负责人
            "state" => $this->post('state'),//状态
            "type" => $this->post('type'),//类型
        );
        $and = "";
        if ($this->post('createTime')) {
            $and .= self::timeComparison($this->post('createTime'));
        }
        //排序
        $orderBy = $this->listSort(array(
            "search"  => $this->post('list_sort_key') ?: 'time',
            "sort" => $this->post('list_sort') ?: "desc",
            "array"   => array(),
        ));
        //获取查询结果
        $where = search(array("like" => $like, "=" => $equal)) . $and;
        $page = $this->page(array("table" => self::table, "where" => $where, "order" => $orderBy['orderBy']));
        $_SESSION[self::page]['sql'] = $page['fullSql'];
        //获取自定义字段参数
        $installSearch = $this->installSearch();
        $body          = [];
        //表格控件区
        $liButton = array(
            $this->checkAll("listForm", "listId")
        );
        //获取记录
        $url = root . "control/adIndex.html?cla=" . self::page;
        foreach ($page['array'] as $array) {
            //列表控件
            $dominate = array(
                "box" => array("name" => "listId", "value" => $array['id']),
                "edit" => array("title" => "编辑", "click" => "layer('" . self::page . "','edit',{id:'" . $array['id'] . "'})"),
                "detail" => array("title" => self::title . "详情", "click" => "newIframe('" . self::title . "详情','" . $url . "&fun=detail&id=" . $array['id'] . "')"),
            );
            $liButton[] = $this->dominate($dominate);
            //本行初始化
            $row = [];
            foreach ($installSearch['key'] as $key) {
                switch ($key) {
                    case "managerId":
                        $row[] = self::findStaff($array['managerId']);
                        break;
                    default:
                        $row[] = isset($array[$key]) && $array[$key] ? $array[$key] : '';
                }
            }
            $body[] = $row;
        }
        //控件
        $button = "";
        //生成页面
        $li = $this->li(array(
            "body" => $body,
            "install" => $installSearch,
            "button" => array("html" => $liButton,"width" => 120),
            "orderBySign" => $orderBy,
            "page" => $page['para'],
        ));
        //返回
        $json['html'] = $page['hint'] . $button . "<form name='listForm'>" . $li . "</form>" . $page['button'] . clear;
        return json_encode($json, 320);
    }


    /**
     * 下载模板
     */
    public function downloadModel()
    {
        $templateId = $this->get('templateId');
        if (!$this->power(self::page, 'edit')) {
            $_SESSION['warn'] = '你还没有编辑的权限';
        }  else {
            $exampleData[] = ['A栋','208','10','A栋2楼','电视,投影','andy','YM20211010001','正常','样例数据，导入时请删除此条数据'];
            $excel    = $this->excelHead();
            $fileName = self::title.'导入模板-'.importTemplateClass::getName($templateId).'.xlsx';
            $filePath = $excel->fileName($fileName, 'sheet1');
            $format = new \Vtiful\Kernel\Format($filePath->getHandle());
            $templateField = importTemplateClass::templateField(self::page, 'importFieldInit', id:$templateId);
            $index         = 0;
            foreach ($templateField as $k => $array) {
                if ($array['display']){
                    $backgroundStyle=null;
                    if (importTemplateClass::getIsMustValue($this->importFieldInit(), $array['columnName'])){
                        //必填项判断
                        $backgroundStyle  = $format->background(
                            0xFFC04B
                        )->toResource();
                    }
                    $filePath->insertText(0, $index, $array['aliasName'],'',$backgroundStyle);
                    foreach ($exampleData as $y=>$example){
                        $exampleVal = match ($array['columnName']){
                            '分类'=>$example[0],
                            '名称'=>$example[1],
                            '可容纳人数'=>$example[2],
                            '所在位置'=>$example[3],
                            '设备'=>$example[4],
                            '负责人'=>$example[5],
                            '负责人编号'=>$example[6],
                            '状态'=>$example[7],
                            '备注'=>$example[8],
                            default=>'',
                        };
                        $filePath->insertText($y+1, $index, $exampleVal);
                    }
                    $index++;
                }
            }

            $text   = $this->control['name'] . "下载了会议室档案导入模板";
            $this->logText(["type" => self::page, "text" => $text]);
            $this->excelOutPut($filePath,$fileName);
            exit(0);
        }
        header("Location:" . getenv("HTTP_REFERER"));
    }

    /*数据导入分析*/
    public function importData()
    {
        $templateId = $this->post('templateId');
        if (!$this->power(self::page, 'edit')) {
            $json['warn'] = '你还没有编辑的权限';
        }  else {
             $fomatArray = [];//导入数据格式同一为TYPE_STRING
            foreach ($this->importFieldInit() as $value){
                $fomatArray[] = \Vtiful\Kernel\Excel::TYPE_STRING;
            }
            $data = $this->importHead(format: $fomatArray);
            $x = 0;
            $text = '';
            $headArray = [];
            $row_list=0;
            foreach ($data as $i => $row) {
                $row_list++;
                if ($i==0){
                    $templateField = importTemplateClass::templateField(self::page, 'importFieldInit', id:$templateId);
                    $headArray = importTemplateClass::combinHead($templateField,$row);
                }
                if ($i > 0) {
                    $rowData = formSubArray($row);
                    //只接收模板中选中的字段的值
                    $cell = [];
                    foreach ($headArray as $index=>$headName){
                        $cell[$headName] = $rowData[$index]??'';
                    }
                    //初始化未被模板需要的字段的值
                    foreach ($this->importFieldInit() as $value){
                        $cell[$value['columnName']] = $cell[$value['columnName']]??'';
                    }
                    $staff = query("staff", "orderNo = '$cell[负责人编号]'");
                    $field = array(
                        "id" => self::getId(),
                        'stid'=>$this->control['stid'],
                        'type' => $cell['分类'],
                        'name' => $cell['名称'],
                        'maxPeople' => $cell['可容纳人数'],
                        'location' =>$cell['所在位置'],
                        'device' => $cell['设备'],
                        'managerId' => $staff['stid'],
                        'text' =>$cell['备注'],
                        'state' => $cell['状态']?:'正常',
                        'updateTime' => $this->time,
                        "time" => date("Y-m-d H:i:s"),
                    );
                    $userNo = codeTemplateClass::generateCode(self::page,[
                        'prefix' => 'MR',
                        'table' => self::table,
                        'field' => 'orderNo',
                        'where' => '',
                    ],$field);
                    $field['orderNo'] = $userNo;

                    $annotation = [
                        'type' => '分类',
                        'name' => '名称',
                        'maxPeople' => '最大容纳人数',
                        'location' => '所在位置',
                        'device' => '设备',
                        'managerId' => '负责人',
                    ];
                    $rules = [
                        'type' => 'required',
                        'name' => 'required',
                        'maxPeople' => 'required',
                        'location' => 'required',
                        'device' => 'required',
                        'managerId' => 'required',
                    ];
                    // 校验是否符合规则
                    $vt = new \verify();
                    $result = $vt->setAliases($annotation)->validate($field, $rules)->isOk();
                    if (empty($field['managerId']) || !$staff['stid']) {
                        $text .= "第【{$row_list}】行：未通过员工编号找到此负责人<br>";
                    } elseif ($result === false) {
                        $text.= "第【{$row_list}】行：".$vt->getErrs()[0]."<br>";  // 多个规则提示最前面一条
                    } else {
                        $warn = insert(["table" => self::table, "field" => $field]);
                        if (in_array($warn, ["新增成功", "更新成功"])) {
                            $x++;
                            $text .= "第【{$row_list}】行导入成功<br>";
                        } else {
                            $text .= "第【{$row_list}】行导入失败：编辑失败<br>";
                        }
                    }
                }
            }
            $total = count($data)-1;
            $json['data'] = [
                'text'=>$text,
                'title'=>"您导入了{$total}条数据，成功{$x}条，失败".($total-$x)."条",
            ];
            $text = $this->control['name'] . '导入了文件：'.$_FILES['file']['name'].'：' . $text;
            $this->logText(["type" => self::page, "text" => $text]);
            $json['warn'] = 2;
        }
        return json_encode($json,320);
    }

    /**
     * 导出
     */
    public function exportData()
    {
        $templateId = $this->get('templateId');
        $checkedId = $this->get('checkedId')?explode(',',$this->get('checkedId')):[];
        if (!$this->power(self::page, 'export')) {
            $_SESSION['warn'] = '你还没有导出的权限';
        }  else {
            $data = [];
            /***********标题**********/
            $title =[];
            $tempFieldAll = importTemplateClass::templateField(self::page, 'exportFieldInit', id:$templateId);
            foreach ($tempFieldAll as $array) {
                if ($array['display']){
                    $title[] = $array['aliasName'];
                }
            }
            //判断是否选中导出
            if (!self::is_null_array($checkedId)){
                $result = find(array(
                    "table" => self::table,
                    "where" => "id in ('".implode("','", $checkedId)."') order by time desc",
                ))['array'];
            }else{
                $sql   = $_SESSION[self::page]['sql'];
                $result   = sqlFind($sql);
            }
            //导出数据生成
            foreach ($result as $array){
                $column = [];
                foreach ($tempFieldAll as $templateField){
                    if ($templateField['display']){
                        $column[] = match ($templateField['columnName']){
                            '会议室编号'=>$array['orderNo'],
                            '分类'=>$array['type'],
                            '名称'=>$array['name'],
                            '可容纳人数'=>$array['maxPeople'],
                            '所在位置'=>$array['location'],
                            '设备'=>$array['device'],
                            '负责人'=>self::findStaff($array['managerId']),
                            '状态'=>$array['state'],
                            '备注'=>$array['text'],
                            '创建人'=>self::findStaff($array['stid']),
                            '创建时间'=>$array['time'],
                            default=>'',
                        };
                    }
                }
                $data[] = $column;
            }
            $text = $this->control['name'] . "导出了会议室档案";
            $this->logText(["type" => self::page, "text" => $text]);
            $this->excelOut($title, $data, "会议室档案.xlsx");
            exit(0);
        }
        header("Location:" . getenv("HTTP_REFERER"));
    }

    /**
     * 编辑页
     * @return string
     */
    public function edit()
    {
        $id = $this->post('id')?:self::getId();
        $info = query(self::table, " id = '" . $id . "' ");
        //表单
        $html = $this->layerEdit([
            "table" => [
                [
                    must . "分类：" => select(["name" => "type", 'class' => 'text', 'title'=>'分类','option'=>explode('，', para('meetingRoomType')), "value" => $info['type']]),
                    must ."名称：" => text(["name" => "name", 'class' => 'text', "value" => $info['name']]),
                ],
                [
                    must ."可容纳人数：" => text(["name" => "maxPeople", 'class' => 'text', "value" => $info['maxPeople']]),
                    must . "所在位置：" =>text(["name" => "location", 'class' => 'text', "value" => $info['location']]),
                ],
                [
                    must . "设备：" => checkbox(["name" => "device", 'value' => explode('，', para('meetingRoomDevice')), "checked" => $info['device']?explode(',', $info['device']):[]]),
                ],
                [
                    must ."负责人：" => selectMultiple(["name" => "managerId",'title'=>'负责人', 'table'=>"staff",'sqlId'=>'stid','sqlField'=>'name',  "value" => $info['managerId']]),
                ],
                [
                    "备注：" => textarea(["name" => "text",  'class' => 'textarea', "value" => $info['text']]),
                ],
            ],
        ]);
        //返回
        return $this->layer(array("title" => L('job.button.editor').self::title, "height" => 350, "html" => $html));
    }

    public function editEdit()
    {
        $id = $this->post('id') ?: self::getId();
        $field = [
            'type'       => $this->post('type'),
            'name'       => $this->post('name'),
            'maxPeople'  => $this->post('maxPeople'),
            'location'   => $this->post('location'),
            'device'     => $this->post('device') ? implode(',', $this->post('device')) : '',
            'managerId'  => $this->post('managerId'),
            'text'       => $this->post('text'),
            'updateTime' => $this->time
        ];
        $annotation = [
            'type' => '分类',
            'name' => '名称',
            'maxPeople' => '最大容纳人数',
            'location' => '所在位置',
            'device' => '设备',
            'managerId' => '负责人',
        ];
        $rules = [
            'type' => 'required',
            'name' => 'required',
            'maxPeople' => 'required',
            'location' => 'required',
            'device' => 'required',
            'managerId' => 'required',
        ];
        // 校验是否符合规则
        $vt = new \verify();
        $result = $vt->setAliases($annotation)->validate($field, $rules)->isOk();
        if ($result === false) {
            $json['warn'] = $vt->getErrs()[0];  // 多个规则提示最前面一条
            goto resp;
        }
        //判断
        if (!$this->power(self::page, "edit")) {
            $json['warn'] = "你没有编辑" . self::title . "的权限";
        } else {
            $where = " id = '$id' ";
            $info = query(self::table, $where);
            if (!$info['id']) {
                $userNo = codeTemplateClass::generateCode(self::page,[
                    'prefix' => 'MR',
                    'table' => self::table,
                    'field' => 'orderNo',
                    'where' => '',
                ],$field);
                $field = array_merge($field, [
                    'id' => $id,
                    'orderNo' => $userNo,
                    'stid' => $this->control['stid'],
                    'state' => '正常',
                    'time' => $this->time
                ]);
                $json['warn'] = static::insert(["table" => self::table, "field" => $field]);
            } else {
                $json['warn'] = static::update([
                    "table" => self::table,
                    "field" => $field,
                    "where" => $where
                ]);
            }
            if (in_array($json['warn'], ["新增成功", "更新成功"])) {
                //添加日志
                $type = mb_substr($json['warn'], 0, 2, 'utf-8');
                $text = $this->control['name'] . $type . "了" . self::title . " id：【" . $id . '】';
                $this->logText(["type" => self::page, "text" => $text]);
                //返回
                $_SESSION['warn'] = $json['warn'];
                $json['warn'] = 2;
                $json['href'] = root . "control/adIndex.html?cla=" . $this->get('cla') . "&fun=detail&id=" . $id;
            }
        }

        resp:
        return json_encode($json, 320);
    }
    /*详情页*/
    public function detail(): string
    {
        $info = query(self::table, " id = '{$this->get('id')}'");
        if (empty($info['id'])) {
            $html = '未找到此' . self::title;
        } else {
            //菜单
            $data = array(
                "id" => $info['id'],
                "title" => self::title . '详情',
            );

            $button = [];
            if ($this->power(self::page, "edit")) {
                //按钮
                $button[] = [
                    "name" => "编辑",
                    "type" => "弹出层",
                    "cla" => $this->get('cla'),
                    "fun" => "edit",
                    "post" => ["id" => $info['id']],
                    'style' => 'li-btn-blue-bg',
                ];

                switch ($info['state']) {
                    case '停用':
                        $firState = '正常';
                        $secState = '维护中';
                        $titleOne = '启用';
                        $titleTwo = '维护';
                        break;
                    case '维护中':
                        $firState = '正常';
                        $secState = '停用';
                        $titleOne = '启用';
                        $titleTwo = '停用';
                        break;
                    default:
                        $firState = '停用';
                        $secState = '维护中';
                        $titleOne = '停用';
                        $titleTwo = '维护';
                        break;
                }
                //按钮
                $button[] = [
                    "name" => $titleOne,
                    "type" => "点击事件",
                    "cla" => $this->get('cla'),
                    "fun" => "layer('".$this->get('cla')."','stateSwitch',{type:'{$firState}',id:'{$info['id']}'})",
                ];
                //按钮
                $button[] = [
                    "name" =>$titleTwo,
                    "type" => "点击事件",
                    "cla" => $this->get('cla'),
                    "fun" => "layer('".$this->get('cla')."','stateSwitch',{type:'{$secState}',id:'{$info['id']}'})",
                ];
            }
            if ($this->power(self::page, "del")){
                //按钮
                $button[] = [
                    "name" => "删除",
                    "type" => "弹出层",
                    "cla" => $this->get('cla'),
                    "fun" => "operate",
                    "post" => ["act" => 'del', "id" => $info['id']],
                ];
            }
            //生成表单
            $data['button'] = $this->tableShowButton($button);
            $data['html'] = $this->tableShow(array(
                '详细信息' => array(
                    array(
                        "分类" => $info['type'],
                        "名称" => $info['name'],
                        "可容纳人数" => $info['maxPeople'],
                    ),
                    array(
                        "所在位置" =>  $info['location'],
                        "设备" => $info['device'],
                        "负责人" =>self::findStaff($info['managerId']),
                    ),
                    array(
                        "备注" => $info['text'],
                    ),
                ),
                '系统信息' => array(
                    array(
                        "会议室编号" => $info['orderNo'],
                        "创建人" => self::findStaff($info['stid']),
                        "创建时间" => $info['time'],
                    ),
                    array(
                        "更新时间" => $info['updateTime'],
                        "状态" => $info['state'],
                    ),
                )
            ));
            //生成页面
            $html = $this->tab($data);
        }
        //返回
        return $html;
    }

    /**
     * 启用/停用
     */
    public function stateSwitch()
    {
        $type = $this->post('type');
        //生成表单
        $html = $this->layerEdit(array("table" => array(
            array(
                "提示：" => "是否更改此会议室状态为：" . $type,
            ),
        ), 'hidden' => hidden(array('name' => 'type', 'value' => $type))));
        //返回
        return $this->layer(array("title" => "状态切换", "height" => 165, "html" => $html));
    }

    /**
     * 启用/停用
     */
    public function stateSwitchEdit()
    {
        $id = $this->post('id');
        $type = $this->post('type');
        $info = query(self::table, " id = '$id'");
        if (!$this->power(self::page, "edit")) {
            $json['warn'] = "你没有" . self::title . "的编辑权限";
        } elseif (empty($info['id'])) {
            $json['warn'] = "未找到此宿舍档案";
        } elseif (!in_array($type, $this->stateOption)) {
            $json['warn'] = "类型错误";
        } else {
            $field = [
                'state' => $type,
            ];
            $json['warn'] = update(array('table' => self::table, 'field' => $field, 'where' => " id ='$id'"));
            if (in_array($json['warn'], ["新增成功", "更新成功"])) {
                //添加日志
                $type = mb_substr($json['warn'], 0, 2, 'utf-8');
                $text = $this->control['name'] . $type . "了" . self::title . "的状态为【{$type}】， id：【" . $id . '】';
                $this->logText(["type" => self::page, "text" => $text]);
                //返回
                $_SESSION['warn'] = $json['warn'];
                $json['warn'] = 2;
            }
        }
        //返回
        return json_encode($json, 320);
    }
    // 操作中转
    public function operate()
    {
        $act = $this->post('act') ?? '';
        $pwd = false; // 需要密码
        $form = $power = '';
        switch ($act) {
            default:
                $act = 'del';
                $msg = '删除' . self::title;
                $title = self::page. 'Delete';
                $function = 'delete';
                $form = self::page . 'OperateForm, listForm';
                $power = '';
                break;
        }
        if (!$this->power(self::page, $act)) {
            $_SESSION['warn'] = '你还没有' . $msg . '的权限';
            $json = [
                'warn' => 2,
                'href' => root . 'control/adIndex.html?cla=' . $this->get('cla') . '&fun=home',
            ];
        } else {
            return $this->confirm([
                'title' => $title,
                'function' => $function,
                'form' => $form,
                'power' => $power,
                'pwd' => $pwd,
            ]);
        }

        resp:
        return json_encode($json, 320);
    }

    /**
     * 删除
     * @return bool|string
     */
    public function delete()
    {
        $array = $this->post('listId') ?? $this->post('id');
        if (!$this->power(self::page, "del")) {
            $json['warn'] = "你没有删除的权限";
        } elseif (empty($array)) {
            $json['warn'] = "你一个数据都没有选择呢";
        } else {
            $text = "";
            $x = 0;
            $array = is_array($array) ? $array : [$array];
            foreach ($array as $id) {
                $info = query(self::table, " id = '$id' ");
                if ($info['state'] !='停用'){
                    //返回
                    $warn = "删除失败：不是停用状态";
                }else{
                    //最后删除基本参数
                    delete(array("table" => self::table, "where" => " id = '$id' "));
                    //返回
                    $warn = "删除成功";
                    $x++;
                }
                $text .= self::title . "ID【" . $info['id'] . "】" . $warn . "。<br>";
            }
            //添加日志
            $text = $this->control['name'] . "删除了" . self::title . "，结果如下：<br>" . $text;
            $this->logText(array("type" => self::page, "text" => $text));
            $_SESSION['warn'] = "删除了" . $x . "个" . self::title . "，详情见系统日志。";
            $json['warn'] = 2;
            $json['href'] = root . "control/adIndex.html?cla=" . $this->get('cla') . "&fun=home";
        }
        return json_encode($json, 320);
    }
    /**
     * 导入模板字段初始化
     * @return array[]
     */
    public function importFieldInit($classify=''): array
    {
        return match ($classify) {
            default=>  [
                [
                    'columnName'=>'分类',
                    'aliasName'=>'分类',

                    'isMust'=>true,
                ],
                [
                    'columnName'=>'名称',
                    'aliasName'=>'名称',

                    'isMust'=>true,
                ],
                [
                    'columnName'=>'可容纳人数',
                    'aliasName'=>'可容纳人数',

                    'isMust'=>true,
                ],
                [
                    'columnName'=>'所在位置',
                    'aliasName'=>'所在位置',

                    'isMust'=>true,
                ],
                [
                    'columnName'=>'设备',
                    'aliasName'=>'设备(多个用英文逗号隔开)',

                    'isMust'=>true,
                ],
                [
                    'columnName'=>'负责人编号',
                    'aliasName'=>'负责人编号',

                    'isMust'=>true,
                ],
                [
                    'columnName'=>'负责人',
                    'aliasName'=>'负责人',

                    'isMust'=>false,
                ],
                [
                    'columnName'=>'状态',
                    'aliasName'=>'状态',

                    'isMust'=>false,
                ],
                [
                    'columnName'=>'备注',
                    'aliasName'=>'备注',

                    'isMust'=>false,
                ],

            ]
        };
    }
    /**
     * 导出模板字段初始化
     * @return array[]
     */
    public function exportFieldInit($classify=''): array
    {
        return match ($classify) {
            default=>  [
                [
                    'columnName'=>'会议室编号',
                    'aliasName'=>'会议室编号',
                ],
                [
                    'columnName'=>'分类',
                    'aliasName'=>'分类',
                ],
                [
                    'columnName'=>'名称',
                    'aliasName'=>'名称',
                ],
                [
                    'columnName'=>'可容纳人数',
                    'aliasName'=>'可容纳人数',
                ],
                [
                    'columnName'=>'所在位置',
                    'aliasName'=>'所在位置',
                ],
                [
                    'columnName'=>'设备',
                    'aliasName'=>'设备',
                ],
                [
                    'columnName'=>'负责人',
                    'aliasName'=>'负责人',
                ],
                [
                    'columnName'=>'状态',
                    'aliasName'=>'状态',
                ],
                [
                    'columnName'=>'备注',
                    'aliasName'=>'备注',
                ],
                [
                    'columnName'=>'创建人',
                    'aliasName'=>'创建人',
                ],
                [
                    'columnName'=>'创建时间',
                    'aliasName'=>'创建时间',
                ],
            ]
        };
    }
}
